﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using DataAccessLayer;

namespace BusinessLayer
{
    public class SignUp
    {
        public string fname { get; set; }
        public string lname { get; set; }
        public string identity { get; set; }
        public string address { get; set; }
        public string contact { get; set; }
        public string email { get; set; }
        public string username { get; set; }
        public string password { get; set; }
        public string type { get; set; }
        public DateTime signup_date { get; set; }

        public SignUp()
        {
            fname = "";
            lname = "";
            identity = "";
            address = "";
            contact = "";
            email = "";
            username = "";
            password = "";
            type = "";
            signup_date = DateTime.MaxValue;

        }

        public SignUp(string fnam, string lnam, string id, string addr, string cont, string mail, string usern, string passwrd, string typ, DateTime signdate)
        {
            fname = fnam;
            lname = lnam;
            identity = id;
            address = addr;
            contact = cont;
            email = mail;
            username = usern;
            password = passwrd;
            type = typ;
            signup_date = signdate;
        }

        public void add_user()
        {
            DataAccessLayer.csDAL objdal = new DataAccessLayer.csDAL();
            List<csparameterListType> par = new List<csparameterListType>();

            par.Add(new csparameterListType("@USER_FNAME", SqlDbType.VarChar, fname));
            par.Add(new csparameterListType("@USER_LNAME", SqlDbType.VarChar,lname));
            par.Add(new csparameterListType("@USER_IDENTITY", SqlDbType.VarChar,identity));
            par.Add(new csparameterListType("@USER_ADDRESS", SqlDbType.VarChar,address));
            par.Add(new csparameterListType("@USER_CONTACT", SqlDbType.VarChar,contact));
            par.Add(new csparameterListType("@USER_EMAIL", SqlDbType.VarChar,email));
            par.Add(new csparameterListType("@USERNAME", SqlDbType.VarChar,username));
            par.Add(new csparameterListType("@USER_PASSWORD", SqlDbType.VarChar,password));
            par.Add(new csparameterListType("@USER_TYPE", SqlDbType.VarChar,type));
            par.Add(new csparameterListType("@SIGNUP_DATE", SqlDbType.Date,signup_date));

            objdal.executespreturnnd("SAVE_USER", par);
        }
    }
}